#ifndef CHITU_BASE_H__
#define CHITU_BASE_H__

#include <math.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>

typedef struct _chitu_array chitu_array;
typedef struct _chitu_matrix chitu_matrix;

struct _chitu_array
{
    double *val;
    uint64_t length;
};

struct _chitu_matrix
{
    double **val;
    uint64_t width;
    uint64_t height;
};

//数组的创建和操作
chitu_array *chitu_array_create(uint64_t len, double init);
void chitu_array_free(chitu_array *a);
void *chitu_array_dataptr(chitu_array *a);
void chitu_array_clear(chitu_array *a);
uint64_t chitu_array_length(chitu_array *a);
bool chitu_array_get(chitu_array *a, uint64_t index, double *data);
bool chitu_array_insert(chitu_array *a, uint64_t index, double data);
void chitu_array_set(chitu_array *a, double n);
void *chitu_array_cat(chitu_array *a, chitu_array *b);
void chitu_array_print(chitu_array *a);
void *chitu_array_copy(chitu_array *a);
void *chitu_array_slice(chitu_array *a, uint64_t start, uint64_t end);

//自定义运算
void chitu_array_cfunct(chitu_array *a, double ( *cfunct)(double));



#endif
